# Cpy-translator a python sintax like C translator to C
# Copyright (C) 2009  Joaquin Duo
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

# PURPOSE: Makefile for unit tests.
#
# ABSOLUTELY NO WARRANTY
#_______________________________________________________________________________
include $(QUEX_PATH)/quex/code_base/core.mkd

# (*) SETUP ____________________________________________________________________
#
# QUEX_PATH    = ../../ # there should be an environment variable 'QUEX_PATH'
#                       # thus this does have to be defined explicitly here.
#
# -- INPUT
MODE_FILES   = depythonize_c.qx
DEBUG_F      = # --debug # set flag if debugging info is required
#
# -- APPLICATION / LIBRARY specification
APPLICATION_NAME = depythonize_c
LIBRARY_NAME     = libLexer
ENGINE_NAME      = depythonize_c_lex# NOTE: a whitespace after this name creates chaos!
#
GENERATED_MODE_FILES = \
		       $(ENGINE_NAME)-core-engine.cpp   \

GENERATED_MODE_OBJS  = $(GENERATED_MODE_FILES:.cpp=.o)
#
ENGINE_SOURCES   = $(ENGINE_NAME)                     \
                   $(ENGINE_NAME).cpp                 \
                   $(ENGINE_NAME)-token_ids           \
		   $(GENERATED_MODE_FILES)
#
LIBRARY_OBJS     = $(ENGINE_NAME).o


# (*) COMPILER SETTINGS ________________________________________________________
#     (change COMPILER to whatever you use as compiler on the command line,
#     e.g. "make COMPILER=icpc" will use intel's c++ compiler)
COMPILER = g++
# -- compiler
CC = $(COMPILER) -c -fPIC -ggdb -Wno-deprecated -Wall \
	 -I./ -I$(QUEX_PATH) $(NDEBUG_F)      \
	 #-DQUEX_OPTION_DEBUG_MODE_TRANSITIONS \
	 #-D__QUEX_OPTION_DEBUG_STATE_TRANSITION_REPORTS

# -- linker
LD         = $(COMPILER) 
STATIC_LD  = ar -rv
DYNAMIC_LD = $(COMPILER) -shared 

# -- Depythonize_c
DEPYTHONIZE_C = depythonize_c

CPP_SOURCES_DIRECTORY = ../cpp

# (*) RULES ____________________________________________________________________
#
create_depythonize_cpp_sources: $(ENGINE_SOURCES)
	#mv *.cpp $(CPP_SOURCES_DIRECTORY)
	mv depythonize_c_lex* $(CPP_SOURCES_DIRECTORY)

$(ENGINE_SOURCES): $(MODE_FILES) $(QUEX_CORE)
	quex --mode-files $(MODE_FILES)    \
	     --engine     $(ENGINE_NAME)   


# (*) HELPERS __________________________________________________________________
#
clean:
	rm depythonize_c_lex*
